package com.spic.business.violation.supervision.speed.controller;

import com.alibaba.fastjson.JSONArray;
import com.spic.business.violation.supervision.speed.domain.ViolationsSpeedRecordVo;
import com.spic.business.violation.supervision.speed.service.IGetHkService;
import com.spic.common.core.web.controller.BaseController;
import com.spic.common.core.web.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 获取海康数据Controller
 *
 * @author wenzhaolong
 * @date 2022-03-10
 */
@RestController
@RequestMapping("/artemis")
public class GetHkController  extends BaseController
{
    private static final Logger log = LoggerFactory.getLogger(GetHkController.class);
    @Autowired
    private IGetHkService getHkService;
    /**
     * 获取海康用户数据
     * @return
     */
    @GetMapping("/personList")
    public AjaxResult getHkPerson()
    {
        JSONArray list = getHkService.personList();
        return AjaxResult.success(list);
    }

    /**
     * 获取海康用户数据
     * @return
     */
    @GetMapping("/vehicleList")
    public AjaxResult vehicleList()
    {
        JSONArray list = getHkService.vehicleList();
        return AjaxResult.success(list);
    }

    /**
     * FDI推送超速记录
     */
    @PostMapping("/saveSpeedData")
    public AjaxResult saveSpeedData(@RequestBody List<ViolationsSpeedRecordVo> list) {
        log.info("========list.size()============> "+list.size());
        return toAjax(getHkService.saveSpeedData(list));
    }

    @PostMapping("/fplAlarmData")
    public AjaxResult getFplAlarmData(){

        return toAjax(getHkService.saveFplAlarmData());
    }
}
